package vsvm.gui;

import java.util.ResourceBundle;

import vsvm.gui.controls.TaskBar;
import vsvm.gui.forms.MainFrame;
import vsvm.gui.objects.Workspace;

public class Environment {
	public static String newline = System.getProperty("line.separator");
		
	  private Environment() {
		  resource = ResourceBundle.getBundle("vsvm.resources.strings");
	  }

	  public static Environment getEnvironment() {
		  if (ref == null)
			  ref = new Environment();		
		  return ref;
	  }

	  public Object clone()	throws CloneNotSupportedException {
	    throw new CloneNotSupportedException(); 
	  }

	  private static Environment ref;
	  
	  
	  
	  private MainFrame mainFrame;
	  
	  public MainFrame getMainFrame() {
		  return mainFrame;
	  }
	  
	  public void setMainFrame(MainFrame mainFrame) {
		  this.mainFrame = mainFrame;
	  }
	  
	  
	  private Workspace workspace;

	  public Workspace getWorkspace() {
		  return workspace;
	  }

	  public void setWorkspace(Workspace workspace) {
		  this.workspace = workspace;
		  mainFrame.getDesktop().closeAll();
		  mainFrame.update();
		  // attach listeners
		  if (workspace != null) {
			  workspace.addChangeListener(mainFrame);
		  }
		  mainFrame.workspaceChanged();
	  }
	  
	  
	  private ResourceBundle resource;

	  public ResourceBundle getResource() {
		  return resource;
	  }
	  
	  private TaskBar taskBar;
	  
	  public TaskBar getTaskBar() {
		  return taskBar;
	  }
	  
	  public void setTeskBar(TaskBar taskBar) {
		  this.taskBar = taskBar;		  
	  }
	  
	  
	  
	  
}
